package com.bw.service.impl;

import com.bw.dao.SpuDao;
import com.bw.entity.PinPai;
import com.bw.entity.Spu;
import com.bw.entity.Type;
import com.bw.service.SpuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SpuServiceImpl implements SpuService {
   @Autowired
    SpuDao spuDao;

    @Override
    public PageInfo<Spu> list(Spu spu, Integer pageNum) {
        PageHelper.startPage(pageNum,3);
        List<Spu> list = spuDao.list(spu);
        PageInfo<Spu> info = new PageInfo<>(list);
        return info;
    }

    @Override
    public List<PinPai> selectBypid() {
        return spuDao.selectBypid();
    }

    @Override
    public List<Type> selectTid(Integer tid1) {
        return spuDao.selectTid(tid1);
    }

    @Override
    public List<PinPai> selectPid(Integer tid1) {
        return spuDao.selectPid(tid1);
    }

    @Override
    public int toInsert(Spu spu) {
        return spuDao.toInsert(spu);
    }

    @Override
    public Spu selectByid(Integer ids) {
        return spuDao.selectByid(ids);
    }

    @Override
    public int toUpdate(Spu spu) {
        return spuDao.toUpdate(spu);
    }

    @Override
    public int deleteByid(Integer[] arr) {
        return spuDao.deleteByid(arr);
    }
}
